<template>
  <primitive :object="Model" :cast-shadow="true" />
</template>

<script setup lang="ts">
import * as THREE from "three";
import { useGLTF, useAnimations, GLTFModel } from "@tresjs/cientos";
import { useTresContext } from "@tresjs/core";
const { scene, camera, renderer } = useTresContext();
const { scene: Model, animations } = await useGLTF("/glb/csmart.glb");
// Model.traverse(function (obj: THREE.Mesh) {
//   if (obj.isMesh) {
//     // 模型材质重新设置
//     obj.material = new THREE.MeshLambertMaterial({
//       color: 0x004444,
//       transparent: true,
//       opacity: 0.5,
//     });
//     // 模型边线设置
//     const edges = new THREE.EdgesGeometry(obj.geometry);
//     const edgesMaterial = new THREE.LineBasicMaterial({
//       color: 0x00ffff,
//     });
//     const line = new THREE.LineSegments(edges, edgesMaterial);
//     obj.add(line);
//   }
// });
camera.value?.lookAt(Model.position);
console.log(scene, animations);
</script>

<style scoped></style>
